echo 构建时间: %date%: %time%
echo 构建分支: %BRANCH_NAME%
echo 提交commit: %SCM_CHANGELOG%
echo 提交人: %CHANGE_AUTHOR%
set cocosGameUrl=http://16.163.174.38/games/%gameName%/%env%/web-mobile/index.html
set realGameName=%gameName%
dir
@echo off
if %gameType%==2d (
   cd game2d
) else (
   cd game3d
   cd d3Games
)
cd scripts
node build.js %gameName% %env% %app%
cd ../build/web-mobile

if %app%==yoyo goto case1
if %app%==zclub goto case2
if %app%==u2 goto case3
goto end

echo 发布环境：%env%
echo 发布游戏：%gameName%

:case1
if %gameName%==slot_aht (
   realGameName=Slots
)
set cocosGameUrl= https://a.fslk.co/games/%realGameName%/%env%/web-mobile/index.html
echo 开始发布游戏 s3://a.fslk.co/games/%gameName%/%env%/web-mobile
aws --profile yoyo s3 sync ./ s3://a.fslk.co/games/%gameName%/%env%/web-mobile
goto end

:case2
set cocosGameUrl= https://res.game.zclub.app/%gameName%/%env%/index.html
echo 开始发布游戏 s3://res.game.zclub.app/%gameName%/%env%
aws --profile zclub s3 sync ./ s3://res.game.zclub.app/%gameName%/%env%
goto end

:case3
if %gameName%==slot_aht (
   realGameName=Slots
)
set cocosGameUrl= https://a.game.amurmur.app/%realGameName%/%env%
echo 开始发布游戏 s3://a.game.amurmur.app/%gameName%/%env%
aws --profile yoyo s3 sync ./ s3://a.game.amurmur.app/%gameName%/%env%
goto end

:end

echo 发布游戏url: %cocosGameUrl%
echo 刷新缓存
nd purge -d "[\"%cocosGameUrl%\"]"